<template>
  <div class="app-main">
    <div class="section-main clearfix">
      <div class="title" v-if="imgUrl">
        <div  class="cutimg">
          <div  class="img-div">
            <img :src="imgUrl" alt="">
          </div>
        </div>
        <div class="font">
          <img src="../../../assets/img/fuqin/font1.png" alt="">
        </div>
      </div>
      <div class="title" v-if="!imgUrl">
        <div class="font2-img">
           <img src="../../../assets/img/fuqin/title.png" alt="">
        </div>

        <div class="font2">
          <img src="../../../assets/img/fuqin/font2.png" alt="">
        </div>
        <div class="title-content">
            <p>Happy Father's Day</p>
            <p>我最爱的老爸节日快乐</p>
        </div>
      </div>
      <p class="content" v-text="content"></p>
    </div>

    <div class="section-bottom">
        <img src="../../../assets/img/fuqin/people2.png" alt="" class="img-fenche">
        <div class="show-div" @click="suremake">
          <btn-router
            :background='require("../../../assets/img/fuqin/btn1.png")'
            color='#fff'
            right='0'
            :width=210
            :height=58
            size='14'
          >生成贺卡</btn-router>
        </div>
        <div class="back-div" @click="goback" >
          <btn-router
           :background='require("../../../assets/img/fuqin/btn1.png")'
              color='#fff'
              right='0'
              :width=210
              :height=58
              size='14'
          >返回上级</btn-router>
        </div>
    </div>
  </div>
</template>

<script>
import btnRouter from '@/components/routerButton'// 跳转按钮组件
import { mapState } from 'vuex'

console.log(mapState)
export default {
  name: 'Show',
  data () {
    return {
    }
  },
  computed: {
    ...mapState({
      imgUrl: state => state.file.imgUrl,
      content: state => state.file.content
    })
  },
  components: {
    btnRouter
  },
  methods: {

    goback () {
      this.$router.go(-1)
    },
    suremake () {
      if (this.imgUrl) {
        var imgfile = this.convertBase64UrlToBlob(this.imgUrl)
        console.log(imgfile)
      }
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
  .app-main{background:url(../../../assets/img/fuqin/background2.png) no-repeat top left;background-size:cover}
  .section-main{position:relative;top:0.2rem;margin: 0 auto;width:100%;padding:5%;z-index: 4}
  .content{overflow: hidden;;padding:5%;font-size:14px;word-break:break-all;}
  .content{margin:0 auto;width:80%; position: relative;height: 4rem;z-index:1;overflow: hidden;font-size:14px;word-break:break-all;line-height: 2em}
  .title{width:100%;position: relative;}
  .title img{width: 100%};
  .title .font{width: 80%;margin:20px auto}
  .title .font2{width: 1.6rem;margin:20px auto}
  .font2-img{width: 0.6rem;position: fixed;top:0}
  .font2-img img{width: 100%}
  .title .title-content{color:#8b5158;letter-spacing: 0.2em;text-align: center;line-height: 1.5em}
  .title .img-font{width:50%;position: relative;left:5%;float: left;}
  .cutimg{margin:0 auto;position: relative;height: 3.5rem;width: 4.9rem;background: gray}
  .img-div{width:100%}
  .cutimg img{width:100%}
  .section-bottom{position:absolute;bottom:0;width:100%}
  .section-bottom img{position:absolute;bottom:0;width:100%;z-index:2;width:2.76rem;bottom:0.8rem;left:.2rem}
  .show-div{position:relative;bottom:.2rem;left:0.5rem;display:inline-block;z-index:5}
  .back-div{position:relative;right:0.5rem;bottom:.2rem;float:right;display:block;z-index:5}
</style>
